/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbBrands")
@NamedQueries({
    @NamedQuery(name = "Brands.findAll", query = "SELECT b FROM Brands b"),
    @NamedQuery(name = "Brands.findByBrandID", query = "SELECT b FROM Brands b WHERE b.brandID = :brandID"),
    @NamedQuery(name = "Brands.findByBrandName", query = "SELECT b FROM Brands b WHERE b.brandName = :brandName"),
    @NamedQuery(name = "Brands.findByBrandDesciption", query = "SELECT b FROM Brands b WHERE b.brandDesciption = :brandDesciption")})
public class Brands implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Brand_ID")
    private Integer brandID;
    @Basic(optional = false)
    @Column(name = "Brand_Name")
    private String brandName;
    @Column(name = "Brand_Desciption")
    private String brandDesciption;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "brands")
    private List<Products> productsList;

    public Brands() {
    }

    public Brands(Integer brandID) {
        this.brandID = brandID;
    }

    public Brands(Integer brandID, String brandName) {
        this.brandID = brandID;
        this.brandName = brandName;
    }

    public Integer getBrandID() {
        return brandID;
    }

    public void setBrandID(Integer brandID) {
        this.brandID = brandID;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getBrandDesciption() {
        return brandDesciption;
    }

    public void setBrandDesciption(String brandDesciption) {
        this.brandDesciption = brandDesciption;
    }

    public List<Products> getProductsList() {
        return productsList;
    }

    public void setProductsList(List<Products> productsList) {
        this.productsList = productsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (brandID != null ? brandID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Brands)) {
            return false;
        }
        Brands other = (Brands) object;
        if ((this.brandID == null && other.brandID != null) || (this.brandID != null && !this.brandID.equals(other.brandID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.Brands[brandID=" + brandID + "]";
    }

}
